<?php

require_once("conn.php");
$result = true;
$db = new DBC();
if (isset($_GET['ids']) && isset($_GET['direct'])) {
    $ids = $_GET['ids'];
    $ids = trim($ids);
    $array = explode(",", $ids);
    foreach ($array as $productid) {
        if ($productid != '') {
            $direct = $_GET['direct'];

            if ($direct == "up") {
                $sql = "UPDATE t_animation SET status = 1 WHERE productid = " . $productid;
                if (isset($_GET['en']) && $_GET['en'] == '1') {
                    $sql = "UPDATE t_animation SET status_en = 1 WHERE productid = " . $productid;
                }
            } else if ($direct == "down") {
                $sql = "UPDATE t_animation SET status = -1 WHERE productid = " . $productid;
                if (isset($_GET['en']) && $_GET['en'] == '1') {
                    $sql = "UPDATE t_animation SET status_en = -1 WHERE productid = " . $productid;
                }
            }
            if ($db->execute($sql)) {
                //success
                //        echo "<script language='javascript'>alert('\u6210\u529f'); </ script>";
            } else {
                //failue
                $result = false;
            }
        }
    }
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    } else {
        $page = 0;
    }
}
if (!$result) {
    echo "<script language='javascript'>alert('\u5931\u8d25'); </script>";
}
echo "<script language='javascript'>location='animationList.php?menu=animation&page=" . $page . "';</script>";
?>
